<template>
  <div style="width: 100%;margin: 0 auto;padding:0px;">
    <el-divider content-position="left">企业信息</el-divider>
    <el-descriptions class="margin-top" style="width: 95%;position: relative;left: 35px;" :column="3" size="mini" border>
<!--      <el-descriptions-item>-->
<!--        <template slot="label">-->
<!--          <i class="el-icon-user"></i>-->
<!--          企业ID-->
<!--        </template>-->
<!--        {{ company.companyId}}-->
<!--      </el-descriptions-item>-->
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          企业名称
        </template>
        {{company.companyName}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          联系人姓名
        </template>
        {{company.contactName}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          职务
        </template>
        {{company.contactPost}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          电子邮箱
        </template>
        {{company.contactEmail}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          手机号
        </template>
        {{company.contactPhone}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          固定电话
        </template>
        {{company.contactTel}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          注册城市
        </template>
        {{company.areaCode}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          缴纳城市
        </template>
        {{company.areaCodes}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          服务费
        </template>
        {{company.serverFee}}元
      </el-descriptions-item>
      <el-descriptions-item :span="3">
        <template slot="label">
          <i class="el-icon-user"></i>
          详细地址
        </template>
        <template>
          {{ company.address | detailAddress }}
        </template>
      </el-descriptions-item>
      <el-descriptions-item :span="3">
        <template slot="label">
          <i class="el-icon-user"></i>
          营业执照号
        </template>
        {{company.businessNo}}
      </el-descriptions-item>
      <el-descriptions-item :span="3">
        <template slot="label">
          <i class="el-icon-user"></i>
          纳税人识别号
        </template>
        {{company.taxpayerNo}}
      </el-descriptions-item>
      <el-descriptions-item :span="3">
        <template slot="label">
          <i class="el-icon-user"></i>
          发票抬头
        </template>
        {{company.billingRise}}
      </el-descriptions-item>
      <el-descriptions-item :span="2">
        <template slot="label">
          <i class="el-icon-user"></i>
          收票邮箱
        </template>
        {{company.collectEmail}}
      </el-descriptions-item>
      <!--0审核中；1审核通过；2审核不通过-->
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          审核状态
        </template>
        <template >
          {{company.auditStatus | auditStatus}}
        </template>

      </el-descriptions-item>
    </el-descriptions>
    <el-divider content-position="left">设置信息-社保养老</el-divider>
    <el-descriptions class="margin-top" style="width: 95%;position: relative;left: 35px;" :column="3" size="mini" border>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          社保养老
        </template>
        <template v-if="setting.checkRetirement===1">
          缴纳
        </template>
        <template v-else>
          不缴纳
        </template>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          社保基数
        </template>
        {{ setting.retirementBase}}元
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          社保养老企业比例
        </template>
        {{ setting.companyRetirementRate}}%
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          社保养老个人比例
        </template>
        {{ setting.personRetirementRate}}%
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          社保失业公司比例
        </template>
        {{ setting.companyUnemploymentRate}}%
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          社保失业个人比例
        </template>
        {{ setting.personUnemploymentRate}}%
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          社保工伤公司比例
        </template>
        {{ setting.companyNdustrialInjuryRate}}%
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          社保残保金公司比例
        </template>
        {{ setting.companyDisabilityBenefitsRate}}%
      </el-descriptions-item>
    </el-descriptions>
    <el-divider content-position="left">设置信息-医保</el-divider>
    <el-descriptions class="margin-top" style="width: 95%;position: relative;left: 35px;" :column="3" size="mini" border>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          社保医疗
        </template>
        <template v-if="setting.checkMedical===1">
          缴纳
        </template>
        <template v-else>
          不缴纳
        </template>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          医保基数
        </template>
        {{ setting.medicalBase}}元
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          医保个人比例
        </template>
        {{ setting.personMedicalRate}}%
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          医保企业比例
        </template>
        {{ setting.companyMedicalRate}}%
      </el-descriptions-item>
    </el-descriptions>
    <el-divider content-position="left">设置信息-公积金</el-divider>
    <el-descriptions class="margin-top" style="width: 95%;position: relative;left: 35px;" :column="3" size="mini" border>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          公积金
        </template>
        <template v-if="setting.checkFund===1">
          缴纳
        </template>
        <template v-else>
          不缴纳
        </template>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          公积金基数
        </template>
        {{ setting.fundBase}}元
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          公积金企业比例
        </template>
        {{ setting.companyFundRate}}%
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          公积金个人比例
        </template>
        {{ setting.personFundRate}}%
      </el-descriptions-item>
    </el-descriptions>
    <el-divider content-position="left">设置信息-工资</el-divider>
    <el-descriptions class="margin-top" style="width: 95%;position: relative;left: 35px;" :column="3" size="mini" border>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          工资
        </template>
        <template v-if="setting.checkWages===1">
          缴纳
        </template>
        <template v-else>
          不缴纳
        </template>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          基础工资
        </template>
        {{ setting.wages}}元
      </el-descriptions-item>
    </el-descriptions>
    <el-divider content-position="left">设置信息-合同</el-divider>
    <el-descriptions class="margin-top" style="width: 95%;position: relative;left: 35px;" :column="3" size="mini" border>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          合同
        </template>
        <template v-if="setting.checkContract===1">
          绑定
        </template>
        <template v-else>
          不绑定
        </template>
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>

<script>
import {reqRep} from "../report/reqReport";
import {requestApiPost} from "../api/api";
import {resRep} from "../report/resReport";

export default {
  name:"",
  props:{
    auditId: {type:String,default:""},
  },
  data(){
    return{
      companyAudit:{
        auditId:"",
        companyId:"",
        auditType:"",
        submitAuditTime:"",
        auditStatus:"",
        auditContent:"",
        content:"",
        userId:""
      },
      setting:{
        settingId:"", //设置ID
        companyId:"", //企业ID
        checkRetirement:"", //社保养老
        retirementBase:"", //社保基数
        companyRetirementRate:"", //社保养老企业比例
        personRetirementRate:"", //社保养老个人比例
        companyUnemploymentRate:"", //社保失业公司比例
        personUnemploymentRate:"", //社保失业个人比例
        companyNdustrialInjuryRate:"", //社保工伤公司比例
        companyDisabilityBenefitsRate:"", //社保残保金公司比例
        checkMedical:"", //社保医疗
        medicalBase:"", //医保基数
        personMedicalRate:"", //医保个人比例
        companyMedicalRate:"", //医保企业比例
        checkFund:"", //公积金
        fundBase:"", //公积金基数
        companyFundRate:"", //公积金企业比例
        personFundRate:"", //公积金个人比例
        checkWages:"", //工资
        wages:"", //基础工资
        checkContract:"", //合同
      },
      company:{
        companyId:"", //企业ID
        companyName:"", //企业名称
        contactName:"", //联系人姓名
        contactPost:"", //职务
        contactEmail:"", //电子邮箱
        contactPhone:"", //手机号
        contactTel:"", //固定电话
        areaCode:"", //注册城市
        infoType:"", //企业/个人 0企业；1个人
        address:"", //详细地址
        businessNo:"", //营业执照号
        businessImageId:"", //营业执照照片ID
        billingRise:"", //发票抬头
        taxpayerNo:"", //纳税人识别号
        invoiceTypeId:"", //发票类型
        specialeNeed:"", //特殊开票需求
        collectEmail:"", //收票邮箱
        point:"", //小数点位数
        serverFee:"", //服务费
        safeBindPhone:"", //安全绑定手机
        auditStatus:"", //审核状态 0审核中；1审核通过；2审核不通过
        userId:"", //所属平台管理员ID
        isDelete:"", //是否删除 0删除；1正常
        createTime:"", //创建时间
        updateTime:"", //更新时间
        status:"", //状态 0不正常；1正常
        areaCodes:"", //缴纳城市
      }
    }
  },
  mounted() {
    this.search();
  },
  methods:{
    search(){
      this.getAudit();
    },
    getAudit(){
      var reqData={"auditId":this.auditId}
      let reqReport = reqRep({ traCode: "_VIEW_AUDIT_COMPANY", data: reqData });
      requestApiPost(reqReport).then((data) => {
        let resReport = resRep(data);
        this.loading = false;
        if (resReport.getReCode() != "0000") {
          this.$message({
            message: resReport.getReMsg(),
            type: "error",
          });
        } else {
          this.companyAudit = resReport.data;
          this.getSetting(this.companyAudit.companyId);
          this.getCompany(this.companyAudit.companyId);
        }
      });
    },
    getSetting(companyId){
      var reqData={"companyId":companyId}
      let reqReport = reqRep({ traCode: "_GET_COMPANY_SETTING", data: reqData });
      requestApiPost(reqReport).then((data) => {
        let resReport = resRep(data);
        this.loading = false;
        if (resReport.getReCode() != "0000") {
          this.$message({
            message: resReport.getReMsg(),
            type: "error",
          });
        } else {
          this.setting = resReport.data;
        }
      });
    },
    getCompany(companyId){
      var reqData={"companyId":companyId}
      let reqReport = reqRep({ traCode: "_GET_AUDIT_COMPANY", data: reqData });
      requestApiPost(reqReport).then((data) => {
        let resReport = resRep(data);
        this.loading = false;
        if (resReport.getReCode() != "0000") {
          this.$message({
            message: resReport.getReMsg(),
            type: "error",
          });
        } else {
          this.company = resReport.data;

        }
      });
    }
  },
  filters: {
    detailAddress(c) {
      var c1=c.split("|");
      if(c1[0]==null||c1[0]==""){
        return "";
      }
      var c2=JSON.parse(c1[0]);
      if(c2.length<=1){
        return c2[0]
      }
      var a="";
      for(var i=0;i<c2.length;i++){
        a+=c2[i];
      }
      if(c1.length==1){
        return a;
      }else{
        return a+c1[1];
      }
    },
    auditStatus(c){
      if(c==0){
        return "未审核";
      }else if(c==1){
        return "审核通过";
      }else if(c==2){
        return "审核不通过";
      }
    }
  },
}
</script>

<style scoped>

</style>
